home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
1372.ZIP
/
PRINTPAS.ARC
/
NONSENSE.PAS
next >
Wrap
Pascal/Delphi Source File
|
1988-10-30
|
3KB
|
90 lines
PROGRAM Nonsense_For_T_P_M_F;
{if program name is too long for double width printing}
{it is printed as emphasized and underlined}
Const
One=1;
Type
shortword=string[5];
FUNCTION Square(number: integer): integer; {use caps for "FUNCTION"}
{begin/end counter starts now,}
{continues whenever there is a change}
Begin
Square:=number*number;
End;
{use caps for "procedure"}
PROCEDURE First(a: byte; b: integer; var c:word);
var {"var" must be on a separate line, comments excepted}
x,y: integer; {this should be italics if your printer supports this}
z : byte;
Begin
x:=One;
y:=b;
z:=a;
z:=Square(z+1);
c:=z;
End;
PROCEDURE Second(d: integer; e: shortword; var f: integer);
PROCEDURE Nested_Procedure(g: byte; var a: shortword);
Var {"Var" must be on a separate line, comments excepted}
s : byte;
u : shortword;
Begin
u:=Chr(g);
s:=length(a);
If Pos(u,a)=s then
begin
a:=Copy(a,1,s-1);
end
End;
var
a: shortword;
g, wordlength: byte;
j: integer;
Begin
Writeln('Enter a word up to four letters long.');
Readln(a);
wordlength:=length(a);
Case wordlength of {the key words "case, of" must be on same line}
1,2,3,4: Writeln('You entered a ',wordlength,' letter word.');
Else Writeln('You entered too long a word.');
End;
f:=0;
For g:=1 to length(a) do
begin
f:=Chr(a[g])+f;
Writeln('Enter ascii code for ',g,' letter of word.');
Readln(j);
If h=j then
begin
Write(#7);
Writeln('Good!');
end;
end;
Nested_Procedure(f div length(a),a); {index number on right side}
{for procedure}
End;
VAR {use caps for global var declaration,also on a separate line}
GlobalA, GlobalB: integer;
GlobalWord : word;
GlobalString : shortword;
GlobalC : byte;
{comment below is required, may be all caps}
BEGIN {main program}
First(GlobalC, GlobalA, GlobalWord);
Second(GlobalB, GlobalString, GlobalA);
GlobalC:=0;
{Procedures/functions emphasized and underlined,}
{indexing is done on right side of paper.}
{Global variables are double strike in main program.}
END. {Table of procedures/functions will be printed after code.}